﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ImbedLibrary
{
    public class RandomHelper
    {

        /// <summary>
        /// 返回随机数
        /// </summary>
        /// <param name="length"></param>
        /// <returns></returns>
        public static string GetRandom(int length = 21)
        {
            Random rd = new Random();
            string str = @"0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZ";
            string result = string.Empty;
            for (int i = 0; i < length; i++)
            {
                result += str.Substring(0 + rd.Next(61), 1);
            }
            return result;
        }
    }
}
